cmake_minimum_required(VERSION 3.10)

project(lv_watch)

set(FONT_SRC ttf)
#set(FONT_SRC bin)
#set(FONT_SRC cfile)

set(lv_watch_sources
  lv_theme_watch_night.c
  modem/modem_adp.c
  modem/mmi_modem_adaptor_call.c
  modem/mmi_modem_adaptor_main.c
  modem/mmi_modem_adaptor_nw.c
  modem/mmi_modem_adaptor_sim.c
  modem/mmi_modem_adaptor_sms.c
  modem/mmi_modem_adaptor_ss.c
  app_adaptor/app_adaptor.c
  framework/message/watch_msg_handle.c
  framework/nvm/ui_nvm_api.c
  lv_objx/lv_watch_activity_obj/lv_watch_activity_obj.c
  lv_objx/lv_watch_tabview/lv_watch_tabview.c
  lv_objx/lv_watch_slider/lv_watch_slider.c
  lv_objx/lv_watch_list/lv_watch_list.c
  lv_objx/lv_watch_obj/lv_watch_obj.c
  lv_theme_watch_night.c
  lv_watch_common.c
  lv_watch.c
  lv_apps/language/language.c
  lv_apps/setting/setting.c
  lv_apps/setting/setting_volume.c
  lv_apps/setting/setting_brightness.c
  lv_apps/setting/setting_date_time.c
  lv_apps/setting/setting_about.c
  lv_apps/setting/setting_volte_switch.c
  lv_apps/setting/setting_bluetooth_ui.c
  lv_apps/setting/setting_bluetooth_msg.c
  lv_apps/setting/setting_wlan.c
  lv_apps/setting/setting_wlan_client.c
  lv_apps/setting/setting_keypad.c
  lv_apps/setting/setting_dual_sim.c
  lv_apps/setting/setting_sd_auto_mount.c
  lv_apps/setting/setting_mobile_network.c
  lv_apps/setting/setting_voice_wakeup.c
  lv_apps/setting/setting_tab.c
  lv_apps/setting/setting_search_switch.c
  lv_apps/setting/setting_flying_mode.c
  lv_apps/restart_and_reset/restart_and_reset.c
  lv_apps/shutdown/shutdown.c
  lv_apps/primary_menu/primary_menu.c
  lv_apps/launcher/launcher.c
  lv_apps/launcher2/launcher.c
  lv_apps/launcher2/launcher_tab.c
  lv_apps/launcher2/launcher_quick_function.c
  lv_apps/dial/dial_switch.c
  lv_apps/dial/dial.c
  lv_apps/dial/unzip.c
  lv_apps/dial/ioapi.c
  lv_apps/dial/dial_element.c
  lv_apps/status_and_setting/status_and_setting.c
  lv_apps/power_off_charging/power_off_charging.c
  lv_apps/weather/weather.c
  lv_apps/factory_mode/factory_mode_main.c
  lv_apps/factory_mode/factory_mode_autotest.c
  lv_apps/factory_mode/factory_mode_testreport.c
  lv_apps/factory_mode/factory_mode_aging.c
  lv_apps/factory_mode/factory_mode_reset.c
  lv_apps/factory_mode/factory_mode_gcf.c
  lv_apps/factory_mode/factory_mode_hwtest.c
  lv_apps/pedometer/pedometer.c
  lv_apps/pedometer/bodyinfo.c
  lv_apps/pedometer/recentrecord.c
  lv_apps/album/album.c
  lv_apps/camera/camera.c
  lv_apps/stopwatch/stopwatch.c
  lv_apps/speech_recog/speech_recog.c
  lv_apps/calendar/calendar.c
  lv_apps/phonebook/phonebook.c
  lv_apps/lowbattery/lowbattery.c
  lv_apps/sos/sos.c
  lv_apps/search/search.c
  lv_apps/qrcode/qrcode.c
  lv_apps/barcode/barcode.c
  lv_apps/make_friends/make_friends.c
  lv_apps/voice_msg/voice_msg.c
  lv_apps/voice_msg/voice_msg_list.c
  lv_apps/voice_msg/voice_msg_test.c
  lv_apps/calculator/calculator.c
  lv_apps/cta/cta_main.c
  lv_apps/cta/cta_phonebook.c
  lv_apps/dialpad/dialpad.c
  lv_apps/phone/phone.c
  lv_apps/phone/phone_api.c
  lv_apps/alarm/alarm.c
  lv_apps/alarm/alarm_set.c
  lv_apps/upgrade/upgrade.c
  lv_apps/quick_function/quick_function.c
  lv_apps/video_call/video_call.c
  lv_apps/video_call/jrtc_client.c
  lv_apps/engineer_mode/engineer_mode_main.c
  lv_apps/engineer_mode/engineer_mode_telephony.c
  lv_apps/engineer_mode/engineer_mode_connectivity.c
  lv_apps/engineer_mode/engineer_mode_hardware_testing.c
  lv_apps/engineer_mode/engineer_mode_location.c
  lv_apps/engineer_mode/engineer_mode_audio_calibration.c
  lv_apps/engineer_mode/engineer_mode_pin.c
  lv_apps/engineer_mode/engineer_mode_keep_screen_on.c
  lv_apps/engineer_mode/engineer_mode_firmware_version.c
  lv_apps/audio_player/audio_player.c
  lv_apps/qrcode_scan/qrcode_scan.c
  lv_apps/imgviewer/imgviewer.c
  lv_apps/heart_rate/heart_rate.c
  lv_apps/call_log/call_log.c
  lv_apps/compass/compass.c
  lv_apps/message/message.c
  lv_apps/timer/timer_clock.c
  lv_apps/exercise/exercise.c
  lv_apps/exercise/exercise_setting.c
  lv_apps/exercise/exercise_sport.c
  lv_apps/exercise/exercise_sport_com.c
  lv_apps/exercise/exercise_outdoor_running.c
  lv_apps/exercise/exercise_outdoor_cycling.c
  lv_apps/exercise/exercise_walking.c
  lv_apps/exercise/exercise_free_training.c
  lv_apps/exercise/exercise_sport_test.c
  lv_apps/sleep/sleep_goal.c
  lv_apps/sleep/sleep_info.c
  lv_apps/elevation/elevation.c
  lv_apps/elevation/pressure.c
  lv_apps/activity/activity.c
  lv_apps/exercise_record/exercise_record.c
  lv_apps/search_phone/search_phone.c
  # lv_apps/qq/net/qq_net_handle.c
  # lv_apps/qq/net/qq_net_test.c
  # lv_apps/qq/net/qq_net_manager.c
  lv_apps/qq/qq_main.c
  lv_apps/qq/qq_login.c
  lv_apps/qq/qq_add_friend.c
  lv_apps/qq/qq_cnf_msg_handle.c
  lv_apps/qq/qq_recent_contact.c
  lv_apps/qq/qq_friend_msg.c
  lv_apps/qq/qq_validation_msg.c
  lv_apps/qq/qq_data.c
)

set(lv_watch_font_sources
  resource/ext/font/lv_font_droidSansFallbackFull_20.c
  resource/ext/font/lv_font_droidSansFallbackFull_30_compressed.c
)

if(${LV_I18N_ENABLE} STREQUAL "TRUE")
  set(lv_watch_multi_lang_sources
    framework/language/lv_i18n/lv_i18n.c
    framework/language/lv_i18n/lv_i18n_lang.c
  )
else()
  set(lv_watch_multi_lang_sources
    framework/language/lang_en.c
    framework/language/lang_ch.c
    framework/language/lang_ar.c
    framework/language/lv_lang.c
  )
endif()

set(lv_watch_true_color_resources
  jpg/background/img_bg_truecolor.jpg
)

#if png what to use raw alpha C, instead of romfs file, need save its map array, put it under ext/png and set as below.
set(lv_watch_raw_alpha_has_map_resources
  ext/png/poweron/img_poweron_logo.png
)

set(lv_watch_raw_alpha_resources
  #png/background/img_background2.png
  png/background/img_background1.png
  #png/poweron/img_poweron_logo.png
  png/make_friends/icon_make_friends_failed.png
  png/make_friends/icon_make_friends_left.png
  png/make_friends/icon_make_friends_succeed.png
  png/make_friends/icon_make_friends_right.png
  png/dial_bear/icon_bear.png
  png/dial_bear/icon_bear_nose.png
  png/dial_rocket/icon_rocket.png
  png/dial_rocket/icon_rocket_digital_0.png
  png/dial_rocket/icon_rocket_digital_1.png
  png/dial_rocket/icon_rocket_digital_2.png
  png/dial_rocket/icon_rocket_digital_3.png
  png/dial_rocket/icon_rocket_digital_4.png
  png/dial_rocket/icon_rocket_digital_5.png
  png/dial_rocket/icon_rocket_digital_6.png
  png/dial_rocket/icon_rocket_digital_7.png
  png/dial_rocket/icon_rocket_digital_8.png
  png/dial_rocket/icon_rocket_digital_9.png
  png/dial_rocket/icon_rocket_digital_s_0.png
  png/dial_rocket/icon_rocket_digital_s_1.png
  png/dial_rocket/icon_rocket_digital_s_2.png
  png/dial_rocket/icon_rocket_digital_s_3.png
  png/dial_rocket/icon_rocket_digital_s_4.png
  png/dial_rocket/icon_rocket_digital_s_5.png
  png/dial_rocket/icon_rocket_digital_s_6.png
  png/dial_rocket/icon_rocket_digital_s_7.png
  png/dial_rocket/icon_rocket_digital_s_8.png
  png/dial_rocket/icon_rocket_digital_s_9.png
  png/dial_dolphin/icon_dolphin.png
  png/dial_dolphin/icon_dolphin_digital_0.png
  png/dial_dolphin/icon_dolphin_digital_1.png
  png/dial_dolphin/icon_dolphin_digital_2.png
  png/dial_dolphin/icon_dolphin_digital_3.png
  png/dial_dolphin/icon_dolphin_digital_4.png
  png/dial_dolphin/icon_dolphin_digital_5.png
  png/dial_dolphin/icon_dolphin_digital_6.png
  png/dial_dolphin/icon_dolphin_digital_7.png
  png/dial_dolphin/icon_dolphin_digital_8.png
  png/dial_dolphin/icon_dolphin_digital_9.png
  png/dial_default/icon_dial_default_dot.png
  png/dial_default/icon_dial_default.png
  png/dial_default/icon_dial_clock.png
  png/dial_bear/icon_dial_bear_clock.png
  png/dial_rocket/icon_dial_rocket.png
  png/dial_dolphin/icon_dial_dolphin.png
  png/dial_rocket/icon_dial_rocket_360.png
  png/dial_dolphin/icon_dial_dolphin_360.png
  png/dial_rocket/icon_rocket_360.png
  png/dial_dolphin/icon_dolphin_360.png
  png/dial/icon_setting.png
  png/dial_default_ambient/icon_none.png
  png/dial_default_ambient/am_digit_bg.png
  png/dial_default_ambient/am_digit_con_colon.png
  png/dial_default_ambient/am_digit_pre.png
  png/dialog_selection/icon_cancel_big.png
  png/dialog_selection/icon_confirm_big.png
  png/setting/icon_setting_upgrade.png
  png/setting/icon_setting_forbidden_shutdown.png
  png/setting/icon_setting_shutdown.png
  png/setting/icon_setting_add_friends.png
  png/setting/icon_setting_volume.png
  png/setting/icon_setting_about.png
  png/setting/icon_setting_network.png
  png/setting/icon_setting_dail_format_switch.png
  png/setting/icon_setting_dail_psm_switch.png
  png/setting/icon_seting_qrcode.png
  png/setting/icon_setting_brightness.png
  png/setting/icon_setting_date_time.png
  png/setting/icon_setting_language.png
  png/setting/icon_setting_time_zone.png
  png/setting/icon_setting_reset.png
  png/setting/icon_setting_ring_music.png
  png/setting/icon_setting_reboot.png
  png/setting/icon_setting_restore.png
  png/setting/icon_decrease.png
  png/setting/icon_increase.png
  png/setting/icon_speaker.png
  png/setting/icon_sub_box_blue.png
  png/setting/icon_sub_box_yellow.png
  png/setting/icon_sub_box_gray.png
  png/setting/icon_setting_volte.png
  png/setting/icon_setting_delete.png
  png/setting/icon_setting_eye_black.png
  png/setting/icon_setting_eye_no_black.png
  png/wifi/icon_setting_wlan.png
  png/wifi/icon_setting_wifi_full.png
  png/wifi/icon_setting_wifi_high.png
  png/wifi/icon_setting_wifi_low.png
  png/wifi/icon_setting_wifi_mid.png
  png/setting/icon_setting_refresh_1.png
  png/setting/icon_setting_refresh_2.png
  png/setting/icon_setting_lock.png
  png/setting/icon_setting_option.png
  png/setting/icon_setting_flying_mode.png
  png/phone/icon_voicecall.png
  png/phone/icon_hook.png
  png/phone/icon_ring_volume.png
  png/phone/icon_ringoff.png
  png/call/icon_send_picture.png
  png/call/icon_call.png
  png/call/icon_chat.png
  png/call/icon_voice_call.png
  png/portrait/icon_relative.png
  png/portrait/icon_all_people.png
  png/portrait/icon_maternal_gradfather.png
  png/portrait/icon_uncle.png
  png/portrait/icon_friends.png
  png/portrait/icon_maternal_gradmother.png
  png/portrait/icon_mother.png
  png/portrait/icon_family.png
  png/portrait/icon_aunt.png
  png/portrait/icon_boy.png
  png/portrait/icon_paternal_gradmother.png
  png/portrait/icon_paternal_gradfather.png
  png/portrait/icon_father.png
  png/portrait/icon_girl.png
  png/pedometer/icon_flag.png
  png/pedometer/icon_pedometer_digital_0.png
  png/pedometer/icon_pedometer_digital_1.png
  png/pedometer/icon_pedometer_digital_2.png
  png/pedometer/icon_pedometer_digital_3.png
  png/pedometer/icon_pedometer_digital_4.png
  png/pedometer/icon_pedometer_digital_5.png
  png/pedometer/icon_pedometer_digital_6.png
  png/pedometer/icon_pedometer_digital_7.png
  png/pedometer/icon_pedometer_digital_8.png
  png/pedometer/icon_pedometer_digital_9.png
  png/pedometer/icon_color_circle.png
  png/pedometer/icon_goal.png
  png/pedometer/icon_bodyweight.png
  png/pedometer/icon_bodyheight.png
  png/pedometer/icon_cal.png
  png/pedometer/icon_step.png
  png/pedometer/icon_distance.png
  png/power_off_charging/icon_power_off_charging_ok.png
  png/power_off_charging/icon_power_off_charging_0.png
  png/power_off_charging/icon_power_off_charging_1.png
  png/power_off_charging/icon_power_off_charging_2.png
  png/power_off_charging/icon_power_off_charging_3.png
  png/power_off_charging/icon_power_off_charging_4.png
  png/power_off_charging/icon_power_off_charging_power.png
  png/weather/icon_sunny.png
  png/weather/icon_fog.png
  png/weather/icon_light_rain.png
  png/weather/icon_cloudy.png
  png/weather/icon_heavy_snow.png
  png/weather/icon_heavy_rain.png
  png/weather/icon_no_network.png
  png/weather/icon_haze.png
  png/weather/icon_light_snow.png
  png/weather/icon_weather_others.png
  png/wifi/icon_wifi_0.png
  png/wifi/icon_wifi_1.png
  png/wifi/icon_wifi_2.png
  png/wifi/icon_wifi_3.png
  png/wifi/icon_wifi_4.png
  png/phone_portrait/icon_ant_small.png
  png/phone_portrait/icon_maternal_gradmother_small.png
  png/phone_portrait/icon_father_small.png
  png/phone_portrait/icon_family_small.png
  png/phone_portrait/icon_paternal_gradfather_small.png
  png/phone_portrait/icon_boy_small.png
  png/phone_portrait/icon_uncle_small.png
  png/phone_portrait/icon_mother_small.png
  png/phone_portrait/icon_maternal_gradfather_small.png
  png/phone_portrait/icon_paternal_gradmother_small.png
  png/phone_portrait/icon_girl_small.png
  png/signal/icon_signal_0.png
  png/signal/icon_signal_1.png
  png/signal/icon_signal_2.png
  png/signal/icon_signal_3.png
  png/signal/icon_signal_4.png
  png/battery/icon_in_charging.png
  png/battery/icon_battery_0.png
  png/battery/icon_battery_1.png
  png/battery/icon_battery_2.png
  png/battery/icon_battery_3.png
  png/battery/icon_battery_4.png
  png/lowbattery/icon_lowbattery_charge.png
  png/status_and_setting/icon_mute.png
  png/status_and_setting/icon_volume.png
  png/status_and_setting/icon_brightness.png
  png/status_and_setting/icon_setting.png
  png/status_and_setting/icon_no_sim_card.png
  png/album/icon_album.png
  png/aiknowledge/icon_grindingears.png
  png/audio_player/icon_music.png
  png/stopwatch/icon_stopwatch.png
  png/heart_rate/icon_heart_rate.png
  png/calendar/icon_calendar.png
  png/voice_msg/icon_wechat.png
  png/phone/icon_telephone.png
  png/blood_pressure/icon_blood_pressure.png
  png/video_call/icon_videocall.png
  png/aiknowledge/icon_aiknowledge.png
  png/setting/icon_settings.png
  png/make_friends/icon_makefriends.png
  png/aiknowledge/icon_magicencyclopedia.png
  png/dialpad/icon_dialpad.png
  png/pedometer/icon_sport.png
  png/speech_recog/icon_answeredquestions.png
  png/quick_function/icon_clear_ram.png
  png/calculator/icon_calculator.png
  png/aiknowledge/icon_recorder.png
  png/camera/icon_camera.png
  png/qrcode/icon_primary_qrcodes.png
  png/alarm/icon_alarm.png
  png/compass/icon_compass.png
  png/message/icon_message.png
  png/timer/icon_timer.png
  png/sleep/icon_sleep.png
  png/elevation/icon_elevation.png
  png/activity/icon_activity.png
  png/dialpad/icon_dialpad_0.png
  png/dialpad/icon_dialpad_1.png
  png/dialpad/icon_dialpad_2.png
  png/dialpad/icon_dialpad_3.png
  png/dialpad/icon_dialpad_4.png
  png/dialpad/icon_dialpad_5.png
  png/dialpad/icon_dialpad_6.png
  png/dialpad/icon_dialpad_7.png
  png/dialpad/icon_dialpad_8.png
  png/dialpad/icon_dialpad_9.png
  png/dialpad/icon_dialpad_dial.png
  png/dialpad/icon_dialpad_dial_pr.png
  png/dialpad/icon_dialpad_back.png
  png/dialpad/icon_dialpad_back_pr.png
  png/dialpad/icon_dialpad_number_bg.png
  png/dialpad/icon_dialpad_number_pr.png
  png/stopwatch/icon_stopwatch_background.png
  png/stopwatch/icon_stopwatch_pause.png
  png/stopwatch/icon_stopwatch_reset.png
  png/stopwatch/icon_stopwatch_start.png
  png/calculator/icon_7.png
  png/calculator/icon_1.png
  png/calculator/icon_div.png
  png/calculator/icon_3.png
  png/calculator/icon_backspace.png
  png/calculator/icon_minus.png
  png/calculator/icon_6.png
  png/calculator/icon_4.png
  png/calculator/icon_0.png
  png/calculator/icon_plus.png
  png/calculator/icon_equal.png
  png/calculator/icon_mul.png
  png/calculator/icon_9.png
  png/calculator/icon_8.png
  png/calculator/icon_2.png
  png/calculator/icon_5.png
  png/calculator/icon_dot.png
  png/camera/icon_camera_shoot.png
  png/camera/icon_memory.png
  png/camera/icon_imgview.png
  png/date_time/icon_date.png
  png/date_time/icon_time.png
  png/voice_msg/icon_bkg.png
  png/voice_msg/icon_text_bkg.png
  png/voice_msg/icon_nonet_debt.png
  png/voice_msg/icon_close.png
  png/voice_msg/icon_back.png
  png/voice_msg/icon_multi_msg.png
  png/voice_msg/icon_send_emo.png
  png/voice_msg/icon_back_blue.png
  png/voice_msg/icon_touch_spk.png
  png/voice_msg/icon_release_snd.png
  png/voice_msg/icon_record1.png
  png/voice_msg/icon_record2.png
  png/voice_msg/icon_record3.png
  png/voice_msg/icon_record4.png
  png/voice_msg/icon_record5.png
  png/voice_msg/icon_sending_voice_bkg.png
  png/voice_msg/icon_snd_voice_succ.png
  png/voice_msg/icon_snd_voice_failed.png
  png/voice_msg/icon_sending1.png
  png/voice_msg/icon_sending2.png
  png/voice_msg/icon_sending3.png
  png/voice_msg/icon_remind.png
  png/voice_msg/icon_voice_damage.png
  png/voice_msg/icon_voice_bubble.png
  png/voice_msg/icon_my_voice_bubble.png
  png/voice_msg/icon_playing1.png
  png/voice_msg/icon_playing2.png
  png/voice_msg/icon_playing3.png
  png/voice_msg/icon_my_playing1.png
  png/voice_msg/icon_my_playing2.png
  png/voice_msg/icon_my_playing3.png
  png/voice_msg/icon_expression_test.png
  png/speech_recog/icon_speech.png
  png/speech_recog/icon_speech_back.png
  png/speech_recog/icon_speech_close.png
  png/speech_recog/icon_speech_next.png
  png/speech_recog/icon_speech_prev.png
  png/speech_recog/icon_speech_button.png
  png/speech_recog/icon_audio_play.png
  png/speech_recog/icon_button_no_touch.png
  png/speech_recog/icon_net_searching.png
  png/speech_recog/icon_recording.png
  png/speech_recog/icon_search_failed.png
  png/speech_recog/icon_refreshing1.png
  png/speech_recog/icon_refreshing2.png
  png/speech_recog/icon_refreshing3.png
  png/speech_recog/icon_refreshing4.png
  png/speech_recog/icon_refreshing5.png
  png/speech_recog/icon_refreshing6.png
  png/speech_recog/icon_refreshing7.png
  png/speech_recog/icon_refreshing8.png
  png/speech_recog/icon_long_touch_spk.png
  png/album/icon_selected.png
  png/album/icon_album_back.png
  png/album/icon_delete_gray.png
  png/album/icon_delete_blue.png
  png/album/icon_more_setting.png
  png/album/icon_share.png
  png/album/icon_select.png
  png/album/icon_no_photo.png
  png/album/icon_check.png
  png/album/icon_del_all_bg.png
  png/album/icon_back_blue.png
  png/engineer/icon_check_test.png
  png/engineer/icon_uncheck.png
  png/lowbattery/icon_lowbattery.png
  png/lowbattery/icon_lowbattery_dial.png
  png/video_call/img_video_call.png
  png/audio_player/icon_audio_player_uncheckbox.png
  png/audio_player/icon_audio_player_checkbox.png
  png/audio_player/icon_audio_player_background.png
  png/audio_player/icon_audio_player_prev.png
  png/audio_player/icon_audio_player_next.png
  png/audio_player/icon_audio_player_pause.png
  png/audio_player/icon_audio_player_play.png
  png/audio_player/icon_audio_player_minus.png
  png/audio_player/icon_audio_player_plus.png
  png/heart_rate/icon_heart_rate_heart.png
  png/heart_rate/icon_heart_rate_highest.png
  png/heart_rate/icon_heart_rate_highest_dot.png
  png/heart_rate/icon_heart_rate_lowest.png
  png/heart_rate/icon_heart_rate_lowest_dot.png
  png/call_log/icon_call_incoming.png
  png/call_log/icon_call_missed.png
  png/call_log/icon_call_outgoing.png
  png/compass/icon_compass_check.png
  png/compass/icon_compass_inside.png
  png/compass/icon_compass_out.png
  png/message/icon_sms_small.png
  png/message/icon_wechat_small.png
  png/message/icon_sms_big.png
  png/message/icon_wechat_big.png
  png/message/icon_message_tip.png
  png/message/icon_message_no_notification.png
  png/timer/icon_timer_start.png
  png/timer/icon_timer_stop.png
  png/timer/icon_timer_pause.png
  png/timer/icon_timer_restart.png
  png/exercise/icon_exercise_add_sport.png
  png/exercise/icon_exercise_body_state.png
  png/exercise/icon_exercise_calorie.png
  png/exercise/icon_exercise_distance.png
  png/exercise/icon_exercise_free_training.png
  png/exercise/icon_exercise_goals.png
  png/exercise/icon_exercise_heart_rate.png
  png/exercise/icon_exercise_interval_reminder.png
  png/exercise/icon_exercise_lock.png
  png/exercise/icon_exercise_mute.png
  png/exercise/icon_exercise_no_goals.png
  png/exercise/icon_exercise_cycling.png
  png/exercise/icon_exercise_running.png
  png/exercise/icon_exercise_pace.png
  png/exercise/icon_exercise_reminder.png
  png/exercise/icon_exercise_remove_sport.png
  png/exercise/icon_exercise_run_with_ai.png
  png/exercise/icon_exercise_smart_coach.png
  png/exercise/icon_exercise_start.png
  png/exercise/icon_exercise_stop.png
  png/exercise/icon_exercise_time.png
  png/exercise/icon_exercise_training_effect.png
  png/exercise/icon_exercise_triangle.png
  png/exercise/icon_exercise_unlock.png
  png/exercise/icon_exercise_volume_max.png
  png/exercise/icon_exercise_volume_min.png
  png/exercise/icon_exercise_volume.png
  png/exercise/icon_exercise_wakey.png
  png/exercise/icon_exercise_walking.png
  png/exercise/icon_exercise_stand.png
  png/sleep/icon_sleep_image.png
  png/elevation/icon_elevation_highest.png
  png/elevation/icon_elevation_lowest.png
  png/activity/icon_activity_calorie.png
  png/activity/icon_activity_climb_stairs.png
  png/activity/icon_activity_distance.png
  png/activity/icon_activity_hours.png
  png/activity/icon_activity_steps.png
  png/activity/icon_activity_strength.png
  png/exercise_record/icon_exercise_record_speed.png
  png/exercise_record/icon_exercise_record_stride_freq.png
  png/exercise_record/icon_exercise_record_stride.png
  png/exercise_record/icon_exercise_record_step_num.png
  png/exercise_record/icon_exercise_record_climb.png
  png/exercise_record/icon_exercise_record_decline.png
  png/exercise_record/icon_exercise_record_altitude.png
  png/exercise_record/icon_exercise_record_sports_and_health.png
  png/search_phone/icon_search_phone_one.png
  png/search_phone/icon_search_phone_sec.png
  png/search_phone/icon_search_phone_trd.png
  png/search_phone/icon_search_phone_for.png
)

set(lv_watch_raw_resources
  gif/anim_power_on.gif
  gif/anim_power_off.gif
  gif/anim_alarm.gif
  gif/anim_search.gif
  gif/anim_sos.gif
  gif/anim_exercise.gif
  audio/audio_msg.amr
  audio/audio_alarm.mid
  audio/audio_power_off.mid
  audio/audio_power_on.mid
  audio/audio_incoming_call.mid
  audio/audio_search.mid
  audio/audio_timer.mid
)

# generate lv_i18n source files
if(${LV_I18N_ENABLE} STREQUAL "TRUE")
  set(LV_I18N_SOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/framework/language/lv_i18n")
  set(LV_I18N_CFG_PATH "${LV_I18N_SOURCE_PATH}/cfg")
  set(LV_I18N_TOOL "${MISC_TOOLS_PATH}/lv_i18n")
  execute_process(
  COMMAND ${LV_I18N_TOOL} asrcompile --excel ${LV_I18N_CFG_PATH} -o ${LV_I18N_SOURCE_PATH}
)
endif()

# if run time load from font binary files
set(lv_watch_font_bin_resources
  font/lv_font_droidSansFallbackFull_20.bin
  font/lv_font_droidSansFallbackFull_30_compressed.bin
)

# if run time load from font ttf
set(lv_watch_font_ttf_resources
  ttf/YH2312F.ttf
)

#if("x${CMAKE_C_COMPILER_ID}" STREQUAL "xARMCC")
add_subdirectory(${EXTERNAL_DIR}/third-party-libs/zbar zbar EXCLUDE_FROM_ALL)
#endif()

# Add the static library
#add_library(lv_watch STATIC ${lv_watch_sources})
if(${FONT_SRC} STREQUAL "cfile")
  add_library(lv_watch STATIC  ${lv_watch_sources} ${lv_watch_font_sources} ${lv_watch_multi_lang_sources})
else()
  add_library(lv_watch STATIC  ${lv_watch_sources} ${lv_watch_multi_lang_sources})
endif()
target_include_directories(lv_watch PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${SDL2_INCLUDE_DIRS} ${PRODUCT_CONFIG_DIR} ${LVGL_DIR})

if("x${CMAKE_C_COMPILER_ID}" STREQUAL "xARMCC")
target_link_libraries(lv_watch PRIVATE lvgl juphoon zbar)
else()
target_link_libraries(lv_watch PRIVATE lvgl juphoon zbar)
endif()

set(RESOURCE "resource")
set(RESOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCE}")
set(RESOURCE_C_PATH "${CMAKE_BINARY_DIR}/lv_watch/resource_c")
set(IMG_CONV_CORE_PHP "${CMAKE_CURRENT_SOURCE_DIR}/../../tools/lv_utils/img_conv_core.php")
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
  set(IMG_CONV_CORE_CMD "${CMAKE_CURRENT_SOURCE_DIR}/../../tools/lv_utils/php.exe" "${IMG_CONV_CORE_PHP}")
else()
  set(IMG_CONV_CORE_CMD php "${IMG_CONV_CORE_PHP}")
endif()

function(IMG_CONV_CORE_FUN srcs cf info_only)
  foreach(src ${srcs})
    get_filename_component(src_path ${src} PATH)
    get_filename_component(src_name_we ${src} NAME_WE)
    set(c_name "${src_path}/${src_name_we}")
    set(c_file "${RESOURCE_C_PATH}/${c_name}.c")
    #message(STATUS "c_file=${c_file}")
    set(IMG_CONV_CORE_PHP_ARGS "\"img=${RESOURCE_PATH}/${src}&format=c_array&cf=${cf}&info_only=${info_only}\
&out_dir=${RESOURCE_C_PATH}/${src_path}\"")
    string(REGEX REPLACE "[/|.]" "_" custom_target ${c_name} )

    add_custom_command(
      OUTPUT ${c_file}
      COMMAND_EXPAND_LISTS
      COMMAND ${IMG_CONV_CORE_CMD} ${IMG_CONV_CORE_PHP_ARGS}
      #COMMAND echo "php ${IMG_CONV_CORE_CMD} ${IMG_CONV_CORE_PHP_ARGS}"
      DEPENDS ${RESOURCE_PATH}/${src} ${IMG_CONV_CORE_PHP}
      COMMENT "create ${c_file}"
    )

    add_custom_target(${custom_target}
      DEPENDS ${c_file}
    )

    set_source_files_properties(
      ${c_file}
      PROPERTIES GENERATED TRUE
    )

    target_sources(lv_watch
      PRIVATE
      ${c_file}
    )

    add_dependencies(lv_watch ${custom_target})
  endforeach()
endfunction()

#all use file decoder instead of variable.
#IMG_CONV_CORE_FUN("${lv_watch_raw_resources}" "raw" "1")
#IMG_CONV_CORE_FUN("${lv_watch_raw_alpha_resources}" "raw_alpha" "1")
#IMG_CONV_CORE_FUN("${lv_watch_true_color_resources}" "true_color_alpha" "0")
IMG_CONV_CORE_FUN("${lv_watch_raw_alpha_has_map_resources}" "raw_alpha" "0")

set(resource_target "lv_watch_generate_resource_romfs")
set(resource_depends_srcs "")
set(resource_output "${CMAKE_CURRENT_BINARY_DIR}/../resource.bin")

function(LIST_ROMFS_DEPENDS_FUN input_list prefix)
  list(TRANSFORM input_list PREPEND ${prefix} OUTPUT_VARIABLE output_list)
  set(resource_depends_srcs ${resource_depends_srcs} ${output_list} PARENT_SCOPE)
endfunction()

LIST_ROMFS_DEPENDS_FUN("${lv_watch_raw_resources}" "${RESOURCE}/")
LIST_ROMFS_DEPENDS_FUN("${lv_watch_raw_alpha_resources}" "${RESOURCE}/")
LIST_ROMFS_DEPENDS_FUN("${lv_watch_true_color_resources}" "${RESOURCE}/")
LIST_ROMFS_DEPENDS_FUN("${lv_watch_font_bin_resources}" "${RESOURCE}/")
LIST_ROMFS_DEPENDS_FUN("${lv_watch_font_ttf_resources}" "${RESOURCE}/")
LIST_ROMFS_DEPENDS_FUN("${lv_watch_raw_alpha_has_map_resources}" "${RESOURCE}/")

set(X_DIR1 "FONT_DIR1")
set(X_DIR2 "FONT_DIR2")
if(${FONT_SRC} STREQUAL "ttf")
  set(X_DIR1 "font")
  add_definitions(-DUSE_FONT_TTF)
elseif(${FONT_SRC} STREQUAL "bin")
  set(X_DIR1 "ttf")
  add_definitions(-DUSE_FONT_BIN)
else()
  set(X_DIR1 "font")
  set(X_DIR2 "ttf")
endif()

if("x${CMAKE_C_COMPILER_ID}" STREQUAL "xARMCC")
  set(SIMULATOR_DIR "simulator")
else()
  set(SIMULATOR_DIR "null_dir")
endif()

if(${USE_WATCH_SPORT} STREQUAL "TRUE")
  #message("can do something only fo watch_sport")
endif()

set(GENROMFS "${MISC_TOOLS_PATH}/genromfs")
if(${USE_WATCH_LITE} STREQUAL "TRUE")
  add_custom_command(
    OUTPUT ${resource_output}
    COMMAND_EXPAND_LISTS
    #COMMAND echo "${GENROMFS} -V \"resource\" -f ${resource_output} -d ${RESOURCE_PATH} -x *.jpg  -x font"
    COMMAND ${GENROMFS}
    #ARGS -V "resource" -f ${resource_output} -d ${RESOURCE_PATH} -x *.jpg -x ext
    ARGS -V "resource" -f ${resource_output} -d ${RESOURCE_PATH} -x *.jpg -x ext -x ${X_DIR1} -x ${X_DIR2} -x ${SIMULATOR_DIR}
    -x /png/activity -x /png/background -x/png/compass -x /png/dial/ -x /png/dial_default_ambient -x /png/elevation -x /png/exercise
    -x /png/exercise_record -x /png/heart_rate -x /png/make_friends -x /png/pedometer -x /png/qq -x /png/quick_function -x /png/wifi
    -x /png/search_phone -x /png/sleep -x /png/timer -x /png/weather -x /png/barcode -x /png/aiknowledge -x /png/blood_pressure -x /ttf/SansSerifArabicF.ttf
    DEPENDS ${resource_depends_srcs}
    COMMENT "create ${resource_output}"
  )
else()
  add_custom_command(
    OUTPUT ${resource_output}
    COMMAND_EXPAND_LISTS
    #COMMAND echo "${GENROMFS} -V \"resource\" -f ${resource_output} -d ${RESOURCE_PATH} -x *.jpg  -x font"
    COMMAND ${GENROMFS}
    #ARGS -V "resource" -f ${resource_output} -d ${RESOURCE_PATH} -x *.jpg -x ext
    ARGS -V "resource" -f ${resource_output} -d ${RESOURCE_PATH} -x *.jpg -x ext -x ${X_DIR1} -x ${X_DIR2} -x ${SIMULATOR_DIR}
    DEPENDS ${resource_depends_srcs}
    COMMENT "create ${resource_output}"
  )
endif()

if(${USE_INTERNAL_ROMFS} STREQUAL "TRUE")
  set(IMG2C python ${CMAKE_CURRENT_SOURCE_DIR}/img2c.py)
  set(python_output "${CMAKE_CURRENT_SOURCE_DIR}/resource.h")
  add_custom_command(
    OUTPUT ${python_output}
    COMMAND_EXPAND_LISTS
    COMMAND ${IMG2C}
    ARGS  ${resource_output} ${python_output}
    DEPENDS ${resource_output}
    COMMENT "create ${python_output}"
  )

  add_custom_target(${resource_target}
    DEPENDS ${python_output}
  )

else()
  add_custom_target(${resource_target}
    DEPENDS ${resource_output}
  )
endif()

add_dependencies(lv_watch ${resource_target})
